/*
 * @Author: your name
 * @Date: 2021-02-03 09:26:29
 * @LastEditTime: 2021-06-16 20:51:46
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \yamian-ui\src\api\user.js
 */
import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export function refreshtoken(data) {
  return request({
    url: '/refreshtoken',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/api/v1/getinfo',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/api/v1/logout',
    method: 'post'
  })
}

export function getSysParameter() {
  return request({
    url: '/api/v1/bw/common/parameter',
    method: 'get'
  })
}

// 七牛上传凭据
export function getQiniuToken() {
  return request({
    url: '/api/v1/cdn/qiniu/getToken',
    method: 'get'
  })
}

// 服务列表(雅眠)
// export function serviceList() {
//     return request({
//         url: "/api/v1/finance/serviceList?pageSize=1000",
//         method: "get"
//     });
// }
export function serviceList(params) {
  return request({
    url: '/api/v1/finance/serviceList',
    method: 'get',
    params
  })
}

// 店铺列表(雅眠)
export function storeList() {
  return request({
    url: '/api/v1/finance/storeList',
    method: 'get'
  })
}

// 核销订单(雅眠)
export function putUserOrder(orderId) {
  return request({
    url: `/api/v1/finance/useOrder/${orderId}`,
    method: 'put'
  })
}

// 获取用户积分，积分兑换比例(雅眠)
export function userScore(orderId) {
  return request({
    url: `/api/v1/finance/userScore`,
    method: 'get'
  })
}

// 后台生成订单(雅眠)
export function postOrder(data) {
  return request({
    url: `/api/v1/finance/order`,
    method: 'post',
    data
  })
}
// 获取用户积分，积分兑换比例(雅眠)
export function userCouponList(phone) {
  return request({
    url: `/api/v1/user/couponList/${phone}?couponStatus=unuse`,
    method: 'get'
  })
}
// 后台修改订单(雅眠)
export function putOrder(data) {
  return request({
    url: `/api/v1/finance/order`,
    method: 'put',
    data
  })
}

// 核销订单(雅眠)
export function putUseOrder(orderId, data) {
  return request({
    url: `/api/v1/finance/useOrder/${orderId}`,
    method: 'put',
    data
  })
}
// 后台支付订单(雅眠)
export function putAdminPay(data) {
  return request({
    url: `/api/v1/finance/adminPay`,
    method: 'put',
    data
  })
}
